using System;
using System.Linq;
using System.Collections.Generic;
using DevExpress.CodeRush.StructuralParser;

namespace CR.StyleCop.Maintainability {
    public class FieldsMustBePrivate : BaseStyleCopIssueSearcher<IFieldElement> {
        public override IEnumerable<StyleCopIssue> FindIssues(IEnumerable<IFieldElement> elements) {
            return elements.Where(f => f.Visibility != MemberVisibility.Private)
                .Select(f => new StyleCopIssue {
                    Element = f,
                    IssueDescription = CR.StyleCop.Resource.FieldMustBePrivateIssueDescription
                });
        }
    }
}
